/**
 * Copyright 2009 the original author or authors.
 *
 * Licensed under the GPL License, Version 3.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.gnu.org/licenses/lgpl-3.0.txt
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.guardianapis.api.client;

import com.guardianapis.api.domain.Format;

public class ItemRequest {

	/*******************************************************************************
	 * Properties
	 *******************************************************************************/

	private String id;
	private Format format;

	/*******************************************************************************
	 * Constructors
	 *******************************************************************************/

	public ItemRequest() {
		this.format = Format.XML;
	}

	public ItemRequest(String pId) {
		this();
		this.id = pId;
	}
	
	public ItemRequest(String pId, Format pFormat) {
		this();
		this.id = pId;
		this.format = pFormat;
	}

	/*******************************************************************************
	 * Override Object Methods
	 *******************************************************************************/

	/** 
	 * This is the Eclipse generate hashCode method
	 * 
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((this.format == null) ? 0 : this.format.hashCode());
		result = prime * result + ((this.id == null) ? 0 : this.id.hashCode());
		return result;
	}

	/** 
	 * This is the Eclipse generate hashCode method
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof ItemRequest))
			return false;
		final ItemRequest other = (ItemRequest) obj;
		if (this.format == null) {
			if (other.format != null)
				return false;
		} else if (!this.format.equals(other.format))
			return false;
		if (this.id == null) {
			if (other.id != null)
				return false;
		} else if (!this.id.equals(other.id))
			return false;
		return true;
	}
	
	/*******************************************************************************
	 * Getters / Setters
	 *******************************************************************************/

	public String getId() {
		return this.id;
	}
	
	public void setId(String pUrl) {
		this.id = pUrl;
	}
	
	public Format getFormat() {
		return this.format;
	}
	
	public void setFormat(Format pFormat) {
		this.format = pFormat;
	}
	
}
